package com.ccp.dev.qbdms.service;

import com.ccp.dev.core.basic.base.BaseService;
import com.ccp.dev.core.basic.util.UUIDUtils;
import com.ccp.dev.core.basic.util.ContextUtil;
import com.ccp.dev.core.basic.web.query.QueryFilter;
import com.ccp.dev.core.util.BeanUtils;
import com.ccp.dev.core.util.StringUtil;
import com.ccp.dev.core.poi.excel.Excel;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import com.ccp.dev.qbdms.dao.WQbdQuasuporgAffirmDao;
import com.ccp.dev.qbdms.model.WQbdQuasuporgAffirm;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * 质量技术支撑机构_资质认定 信息操作服务类
 *
 * @author y
 * @date 2020-07-08 11:17:18
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class WQbdQuasuporgAffirmService extends BaseService<WQbdQuasuporgAffirm> {

    @Resource
    private WQbdQuasuporgAffirmDao dao;

    public HSSFWorkbook exportExcel(Excel excel,QueryFilter queryFilter){
    List<WQbdQuasuporgAffirm> dataList = this.dao.queryAll(queryFilter);
        int startRow = 1;
        //给每一个单元格赋值
        for (WQbdQuasuporgAffirm data : dataList) {
        excel.cell(startRow, 0).value(data.getAffirmId());
        //excel.cell(startRow, 1).value(data.getMc());
        //可在赋值时，根据需求进行格式化
        //excel.cell(startRow, 2).value(DateFormatUtil.formatDate(data.getRq()));
        //excel.cell(startRow, 3).value(data.getSj());
        //excel.cell(startRow, 4).value(data.getTenantId());
        startRow++;
        }
        return excel.getWorkBook();
    }

    /**
     * 根据主表id查询数据
     * @param refId 主表id
     * @return list
     */
    public List<WQbdQuasuporgAffirm> queryByRefId(String refId){
        return dao.queryByRefId(refId);
    }
    /**
     * 根据主表id删除数据
     * @param refId 主表id
     * @return num
     */
    public int delByRefId(String refId){
       return dao.delByRefId(refId);
    }

}
